//****************************************************************
//* Copyright (c) 2008 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   FullEconomicsFacade.java  $$
//* $$Revision:   1.11  $$
//* $$Author:   TMALDON4  $$
//* $$Date:   Mar 13 2009 11:55:58  $$
//*
//*****************************************************************
package ar.com.ford.it.fullEconomics.facade;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Map;

import ar.com.ford.it.fullEconomics.exception.FullEconomicsException;
import ar.com.ford.it.fullEconomics.logic.FullEconomicsLogic;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas012VehicleVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesc01Coststruct;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesc02Coststvers;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesc03Subcoststr;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesc07Subcstitem;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesf01Fulleconom;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesf02Fullecoitm;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesg01Plant;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesp06Mix;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesr02Requestitm;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesr04Agreemitem;
import ar.com.ford.it.fullEconomics.persistence.dto.Teess01Supplier;
import ar.com.ford.it.fullEconomics.struct.FullEconomicsExcercisesStruct;
import ar.com.ford.it.fullEconomics.struct.FullEconomicsStruct;
import ar.com.ford.it.fullEconomics.struct.FullEconomicsTotalStruct;
import ar.com.ford.it.fullEconomics.struct.MacropartStruct;
import ar.com.ford.it.fullEconomics.wslx.FullEconomicsWslxUser;

public class FullEconomicsFacade {

    /**
     * 
     * @param costStructureVersion
     * @return
     * @throws FullEconomicsException
     */
    public Teesf01Fulleconom findFullEconomicsByCostStrVersion(
                                                               Teesc02Coststvers costStructureVersion)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();
        Teesf01Fulleconom ret = logic
                .findFullEconomicsByCostStrVersion(costStructureVersion);

        return ret;
    }

    /**
     * 
     * @param fullEconomics
     * @throws FullEconomicsException
     */
    public void deleteFullEconomics(Teesf01Fulleconom teesf01Fulleconom)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();

        logic.deleteFullEconomic(teesf01Fulleconom);
    }

    /**
     * 
     * @param fullEconomics
     * @throws FullEconomicsException
     */
    public void proposeFullEconomics(Teesf01Fulleconom teesf01Fulleconom,
                                     FullEconomicsWslxUser user)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();

        logic.proposeFullEconomics(teesf01Fulleconom, user);
    }

    /**
     * 
     * @param fullEconomics
     * @throws FullEconomicsException
     */
    public void approveFullEconomics(Teesf01Fulleconom teesf01Fulleconom,
                                     FullEconomicsWslxUser user)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();

        logic.approveFullEconomics(teesf01Fulleconom, user);
    }
    
    /**
     * 
     * @param teesf01Fulleconom
     * @param requestItem
     * @throws FullEconomicsException
     */
    public void setRequestItem(Teesf01Fulleconom teesf01Fulleconom,Teesr02Requestitm requestItem)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();

        logic.setRequestItem(teesf01Fulleconom, requestItem);
    }

    /**
     * 
     * @param fullEconomics
     * @throws FullEconomicsException
     */
    public void rejectFullEconomics(Teesf01Fulleconom teesf01Fulleconom,
                                    FullEconomicsWslxUser user)
            throws FullEconomicsException {
        FullEconomicsLogic logic = new FullEconomicsLogic();

        logic.rejectFullEconomics(teesf01Fulleconom, user);
    }

    /**
     * 
     * @param string
     * @param supplier
     * @param vehicleLine
     * @param mix
     * @return
     * @throws FullEconomicsException
     */
    public MacropartStruct buildMacropart(Teesc01Coststruct costStr,
    									  Ncas012VehicleVw vehicleLine,
                                          Teesp06Mix mix)
            throws FullEconomicsException {
        MacropartStruct ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.buildMacropart(costStr, vehicleLine, mix);
        return ret;
    }
    
    /**
     * 
     * @param agreemItem
     * @param vehicleLine
     * @param mix
     * @return
     * @throws FullEconomicsException
     */
    public MacropartStruct buildMacropart(Teesr04Agreemitem agreemItem,
                                          Teesp06Mix mix)
            throws FullEconomicsException {
        MacropartStruct ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.buildMacropart(agreemItem, mix);
        return ret;
    }

    /**
     * 
     * @param costStrVersion
     * @param macropartStruct
     * @param econLevel2
     * @param econLevel1
     * @param econLevel2Forecasted
     * @param econLevel1Forecasted
     * @return
     * @throws FullEconomicsException
     */
    public Collection<FullEconomicsStruct> getFullEconomicsStructCol(
                                                                     Teess01Supplier supplier,
                                                                     Teesc03Subcoststr subCostStr,
                                                                     BigDecimal pu,
                                                                     Timestamp econLevel1,
                                                                     String econLevel1Forecasted,
                                                                     Timestamp econLevel2,
                                                                     String econLevel2Forecasted,
                                                                     int tier,
                                                                     Map<Teesc03Subcoststr, Collection<Teesc07Subcstitem>> mapaNodosNiveles, 
                                                                     Boolean activacionNiveles)
            throws FullEconomicsException {
        Collection<FullEconomicsStruct> ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.getFullEconomicsStructCol(supplier, subCostStr, pu,
                econLevel1, econLevel1Forecasted, econLevel2,
                econLevel2Forecasted, tier, mapaNodosNiveles, activacionNiveles);
        return ret;
    }

    public Collection<FullEconomicsStruct> getFullEconomicsStructCol(
                                                                     Collection<FullEconomicsStruct> fullEconomicsStructCol,
                                                                     Collection<BigDecimal> altValueCol) {
        Collection<FullEconomicsStruct> ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.getFullEconomicsStructCol(fullEconomicsStructCol,
                altValueCol);
        return ret;
    }

    public Collection<FullEconomicsStruct> getFullEconomicsStructCol(Teesf01Fulleconom fullEconomic,
    		Map<Teesc03Subcoststr, Collection<Teesc07Subcstitem>> mapaNodosNiveles)
            throws FullEconomicsException {
        Collection<FullEconomicsStruct> ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.getFullEconomicsStructCol(fullEconomic, mapaNodosNiveles);
        return ret;
    }

    /**
     * 
     * @param colFullEconomicsStruct
     * @return
     */
    public FullEconomicsTotalStruct calculateTotals(
                                                    Collection<FullEconomicsStruct> colFullEconomicsStruct) {
        FullEconomicsTotalStruct ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.calculateTotals(colFullEconomicsStruct);
        return ret;
    }

    public Collection<Teesf01Fulleconom> getFullEconomicsCol(
                                                             FullEconomicsExcercisesStruct fullEconomicsExcercisesStruct)
            throws FullEconomicsException {

        Collection<Teesf01Fulleconom> ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.findFullEconomicsByStruct(fullEconomicsExcercisesStruct);
        return ret;
    }

    /**
     * 
     * @param colFullEconomicsStruct
     * @return
     */
    public Teesf01Fulleconom createFullEconomic(
                                                Collection<Teesf02Fullecoitm> colFullEconItem,
                                                FullEconomicsWslxUser user)
            throws FullEconomicsException {
        Teesf01Fulleconom ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();

        ret = logic.createFullEconomic(colFullEconItem, user);
        return ret;
    }

    public Teesf01Fulleconom getFullEconomicsByCode(Integer code,
                                                    Teesg01Plant plant)
            throws FullEconomicsException {
        Teesf01Fulleconom ret = null;
        FullEconomicsLogic logic = new FullEconomicsLogic();
        ret = logic.getFullEconomicsByCode(code, plant);
        return ret;
    }

    public boolean isFullEconomicApprovable(Teesf01Fulleconom fullEconomic, FullEconomicsWslxUser user)
            throws FullEconomicsException {
        boolean ret;
        FullEconomicsLogic logic = new FullEconomicsLogic();
        ret = logic.isFullEconomicApprovable(fullEconomic, user);
        return ret;
    }

}
